package com.ruix.app.ui.message;

import android.content.Context;
import android.content.Intent;
import android.widget.TextView;

import com.ruix.app.R;
import com.ruix.app.mapper.PostCardMapper;
import com.ruix.app.mapper.PostCommentsMapper;
import com.ruix.app.model.Comment;
import com.ruix.app.model.MessageModel;
import com.ruix.app.network.RXObserver;
import com.ruix.app.network.RequestFactory;
import com.ruix.app.ui.base.BaseActivity;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

import io.reactivex.disposables.Disposable;

/**
 * Created by hadexs on 2017/5/7.
 */

public class MessageReportActivity extends BaseActivity {


    public static Intent newInstant(Context context, MessageModel messageModel) {
        Intent intent = new Intent(context, MessageReportActivity.class);
        intent.putExtra("MessageModel", messageModel);
        return intent;
    }

    private MessageModel messageModel;
    private   TextView conten;
    private   TextView createTime;

    @Override
    protected int loadViewLayout() {
        return R.layout.activity_message_report;
    }

    @Override
    protected void initView() {
        setTitle("举报成功");
        conten = (TextView) findViewById(R.id.tv_content);
        createTime = (TextView) findViewById(R.id.tv_create_time);
    }

    @Override
    protected void initLocalData() {
        Intent intent = getIntent();
        if (intent != null) {
            messageModel = (MessageModel)intent.getSerializableExtra("MessageModel");
        }

        if (messageModel != null){
            conten.setText(messageModel.getContent());
            createTime.setText(buildeDisplayTime(messageModel.getCreatedTime()));
        }
    }

    private String buildeDisplayTime(long ceratedTime) {
        if (ceratedTime > 0) {
            SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日");
            Date d1 = new Date(ceratedTime);
            return format.format(d1);
        }
        return "";
    }


    @Override
    protected void initListener() {

    }

}
